import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("请输入两个整数》》");
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        //保证a<b
        if(a > b){
            int t = a;
            a = b;
            b = a;
        }
        for (int i = a; i <= a; i--) {
            if(a % i == 0&&b % i == 0){
                System.out.println(i);
                break;


            }

        }
    }
}